import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn, ManyToOne, JoinColumn } from 'typeorm';
import { Users } from '../../users/entities/user.entity';

@Entity({ name: 'todo' })
export class Todo {
  @PrimaryGeneratedColumn({ name: '_Identify' })
  _Identify: number;

  @CreateDateColumn({ name: 'date' })
  date: Date;

  @Column({ name: 'todocontent', type: 'text' })
  todocontent: string;

  @Column({ name: 'author', type: 'int' })
  author: number;

  @ManyToOne(() => Users, { eager: true })
  @JoinColumn({ name: 'author', referencedColumnName: 'id' })
  authorUser: Users;

  @Column({ name: 'finished', type: 'bit', default: false })
  finished: boolean;

  @Column({ name: 'finishtime', type: 'datetime', nullable: true })
  finishtime: Date;

  @Column({ name: 'type' })
  type: string;

  @Column({ name: 'todoid' })
  todoid: string;

  @Column({ name: 'todotitle' })
  todotitle: string;

  @Column({ name: 'picture', nullable: true })
  picture: string;

  @UpdateDateColumn({ name: 'updatetime' })
  updatetime: Date;

  @Column({ name: 'remind', type: 'bit', default: false })
  remind: boolean;

  @Column({ name: 'department', type: 'int' })
  department: number;

  @Column({ name: 'accountrecord', type: 'bit', default: false })
  accountrecord: boolean;

  @Column({ name: 'accountrecordinfo', nullable: true })
  accountrecordinfo: string;

  @Column({ name: 'deleted', type: 'bit', default: false })
  deleted: boolean;

  @Column({ name: 'postponed', type: 'bit', default: false })
  postponed: boolean;

  @Column({ name: 'account_completed', type: 'bit', default: false })
  account_completed: boolean;
} 